//
//  SS_WechatCell.swift
//  SSNews
//
//  Created by 叶竞泽 on 2017/5/2.
//  Copyright © 2017年 叶竞泽. All rights reserved.
//

import UIKit

class SS_WechatCell: UITableViewCell {
    
    var data: WeChatData? {
        didSet {
            if data?.title != nil {
                titleLabel.text = data?.title
                titleLabel.isHidden = false
            }
            
            if data?.source != nil {
                souceLabel.text = "微信公众号: \(data?.source ?? "")"
                souceLabel.isHidden = false
            }
            
            if let firstImage = data?.firstImg {
                if let url = URL(string: firstImage) {
                    self.firstImage.setImageWith(url)
                }
            }
        }
    }
    
    @IBOutlet weak var titleLabel: UILabel!
    
    @IBOutlet weak var souceLabel: UILabel!

    @IBOutlet weak var firstImage: UIImageView!

    override func awakeFromNib() {
        super.awakeFromNib()
        
        selectionStyle = .none
        titleLabel.isHidden = true
        souceLabel.isHidden = true
    }
}
